package mt.comm;

import java.io.Serializable;
import mt.Order;

class ServerSideMessageImpl implements ServerSideMessage, Serializable {
	private static final long serialVersionUID = -7582868482273274672L;
	private Type type;
	private String senderNickname;
	private Order order;

	/**
	 * @param type
	 *            The message type
	 */
	public ServerSideMessageImpl(Type type) {
		super();
		this.type = type;
	}

	/**
	 * @param type
	 *            The message type
	 * @param senderNickname
	 *            The sender nickname
	 */
	public ServerSideMessageImpl(Type type, String senderNickname) {
		super();
		this.type = type;
		this.senderNickname = senderNickname;
	}

	/**
	 * @param type
	 *            The message type
	 * @param senderNickname
	 *            The sender nickname
	 * @param order
	 *            The {@link Order} in the message.
	 */
	public ServerSideMessageImpl(Type type, String senderNickname, Order order) {
		super();
		this.type = type;
		this.senderNickname = senderNickname;
		this.order = order;
	}

	@Override
	public Type getType() {
		return type;
	}

	@Override
	public String getSenderNickname() {
		return senderNickname;
	}

	@Override
	public Order getOrder() {
		return order;
	}

	@Override
	public String toString() {
		return "MessageToServer [type=" + type + ", senderNickname="
				+ senderNickname + ", order=" + order + "]";
	}
}